Skip to content

Conversation

greghuels
Copy link
Contributor


labels: mergeable

Fixes: FF-4105

Motivation and Context

A bandit flag is not returned in UFC when there are no allocations assigned to it, however the "default variation" is still desired in that scenario. Currently, the programmatic default is used.

Description

Updates getBanditAction() so that it falls back to the flag evaluation if the bandit flag does not exist

if (banditEvaluation == null) {
logger.warn(`${loggerPrefix} No assigned variation. Bandit not found: ${flagKey}`);
return { variation: defaultValue, action: null };
return { variation: this.getStringAssignment(flagKey, defaultValue), action: null };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider adding a test for this situation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For precomputed, I think the change should be made the edge compute method, not this client.

Basically, part of the edge compute logic should be evaluating a bandit flag whether it has an active bandit allocation or not--not the responsibility of the downstream client.

For null, we'd do the same as getPrecomputedAssignment(), and do a check like:

if (assignedVariation == null) {
  logger.warn(`[Eppo SDK] No assigned variation. Bandit flag not found: ${flagKey}`);
  return defaultValue;
}

But otherwise would expect something in the format { variation: <variation to return>, action: null} in that case

@greghuels
Copy link
Contributor Author

Closing as this isn't the right fix

@greghuels greghuels closed this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants